home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The 640 MEG Shareware Studio 4
/
The 640 Meg Shareware Studio CD-ROM Volume IV (Data Express)(1994).ISO
/
clang
/
cujaug93.zip
/
1108115A
< prev
next >
Wrap
Text File
|
1993-06-09
|
555b
|
30 lines
/* inspect.c: Inspect the bytes of an object */
#include <stdio.h>
void inspect(const void *ptr, size_t nbytes)
{
int i;
const unsigned char *p = ptr;
for (i = 0; i < nbytes; ++i)
printf("byte #%d: %02X\n",i,p[i]);
putchar('\n');
}
main()
{
char c = 'a';
int i = 100;
long n = 100000L;
double pi = 3.141529;
char s[] = "hello";
inspect(&c,sizeof c);
inspect(&i,sizeof i);
inspect(&n,sizeof n);
inspect(&pi,sizeof pi);
inspect(s,sizeof s);
return 0;
}